#!/bin/sh

# See here for more info:
# http://www.ameir.net/blog/archives/27-Free-mail-relay-servers.html

apt-get update && apt-get -y install postfix-tls

postconf -e 'relayhost = [smtp.gawab.com]:587'

postconf -e 'smtp_sasl_auth_enable = yes'

postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'

postconf -e 'smtp_sasl_security_options ='

# I disabled tls because Postfix complained about a self-signed certificate.

# postconf -e 'smtp_use_tls = no' # uncomment if needed

echo "[smtp.gawab.com]:587   USERNAME@gawab.com:PASSWORD" > /etc/postfix/sasl_passwd

chown root:root /etc/postfix/sasl_passwd

chmod 600 /etc/postfix/sasl_passwd

postmap /etc/postfix/sasl_passwd

/etc/init.d/postfix restart